using System;
using System.Collections.Generic;
using System.Diagnostics;
using Rhizome.Contract;
using Rhizome.Contract.Diag;

namespace Rhizome.Model
{
	public abstract class TransitionBase : RhizomeElement, ITransition, IActionSource
	{
		protected TransitionBase(object @event, IAction action) : this()
		{
			if (@event == null) throw new ArgumentNullException("event");

			Event = @event;
			Action = action;
		}

		protected TransitionBase()
		{
		}

		protected TransitionBase(object @event) : this(@event, null)
		{
		}


		/// <summary>
		/// Gest and sets transition action
		/// </summary>
		public IAction Action { get; set; }

		#region ITransition Members

		public object Event { get; set; }
		public abstract object GetTransitionState();

		object IIdentityAccessor<object>.Id
		{
			[DebuggerStepThrough]
			get { return Event; }
		}

		#endregion
	}
}